package com.lcredu.lcrsnack.commodity.service.impl;

import org.springframework.stereotype.Service;

import java.util.Map;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.lcredu.common.utils.PageUtils;
import com.lcredu.common.utils.Query;

import com.lcredu.lcrsnack.commodity.dao.BrandDao;
import com.lcredu.lcrsnack.commodity.entity.BrandEntity;
import com.lcredu.lcrsnack.commodity.service.BrandService;


@Service("brandService")
public class BrandServiceImpl extends ServiceImpl<BrandDao, BrandEntity> implements BrandService {
    //给查询带上条件(按照名字进行查询)
    @Override
    public PageUtils queryPage(Map<String, Object> params) {

        QueryWrapper<BrandEntity> brandEntityQueryWrapper = new QueryWrapper<>();
        brandEntityQueryWrapper.like("name", params.get("name"));

        IPage<BrandEntity> page = this.page(
                new Query<BrandEntity>().getPage(params),brandEntityQueryWrapper
//                new QueryWrapper<BrandEntity>()
        );

        return new PageUtils(page);
    }

}
